<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">患者列表</div>
                </div>
                <div class="widget-body am-fr">
                    <!-- 工具栏 -->
                    <div class="page_toolbar am-margin-bottom-xs am-cf">
                    <form class="toolbar-form" action="">
                            <input type="hidden" name="s" value="/<?= $request->pathinfo() ?>">
                            <div class="am-u-sm-12 am-u-md-9 am-u-sm-push-0">
                                <div class="am-u-sm-12 am-u-md-3">
                                <div class="am-form-group">
                                    <div class="am-btn-toolbar">
                                        <div class="am-btn-group am-btn-group-xs">
                                            <?php if (checkPrivilege('order.operate/export')): ?>
                                                <a class="j-export am-btn am-btn-success am-radius"
                                                   href="javascript:void(0);">
                                                    <i class="iconfont icon-daochu am-margin-right-xs"></i>导出
                                                </a>
                                            <?php endif; ?>
                            
                                        </div>
                                    </div>
                                </div>
                            </div>
                                <div class="am fr">
                                    <div class="am-form-group tpl-form-border-form am-fl">
                                        <input type="text" name="start_date"
                                               class="am-form-field"
                                               value="<?= $request->get('start_date') ?>" placeholder="请选择注册起始日期"
                                               data-am-datepicker>
                                    </div>
                                    <div class="am-form-group tpl-form-border-form am-fl">
                                        <input type="text" name="end_date"
                                               class="am-form-field"
                                               value="<?= $request->get('end_date') ?>" placeholder="请选择注册截止日期"
                                               data-am-datepicker>
                                    </div>
                                    <div class="am-form-group am-fl">
                                    
                                </div>
                                    <div class="am-form-group am-fl">
                                        <div class="am-input-group am-input-group-sm tpl-form-border-form">
                                            <input type="text" class="am-form-field" name="key"
                                                   placeholder="请输入姓名/微信名称或者手机号"
                                                   value="<?= $request->get('key') ?>">
                                            <div class="am-input-group-btn">
                                                <button class="am-btn am-btn-default am-icon-search"
                                                        type="submit"></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="am-scrollable-horizontal am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped
                         tpl-table-black am-text-nowrap">
                            <thead>
                            <tr>
                                <th>用户ID</th>
                                <th>姓名</th>
                                <th>与本人关系</th>
                                <th>身份证号码</th>
                                <th>推荐人</th>
                                <th>性别</th>
                                <th>名族</th>
                                <th>生日</th>
                                <th>手机号</th>
                                <th>添加时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if (!$list->isEmpty()): foreach ($list as $item): ?>
                                <tr>
                                    <td class="am-text-middle"><?= $item['jiuzhen_id'] ?></td>
                                    <td class="am-text-middle"><?= $item['name'] ?></td>
                                    <td class="am-text-middle"><?= $item['guanxi'] ?></td>
                                   
                                    <td class="am-text-middle"><?= $item['zhengjiannb'] ?></td>
                                    <td class="am-text-middle">
    <?= $item['recommender_name'] ? $item['recommender_name'] : ($item['recommender_nickname'] ? $item['recommender_nickname'] : '平台') ?></td>
                                    <td class="am-text-middle"><?= $item['sex'] ?></td>
                                    <td class="am-text-middle"><?= $item['minzu'] ?></td>
                                    <td class="am-text-middle"><?= $item['shengri'] ?></td>
                                    <td class="am-text-middle"><?= $item['phone'] ?></td>
                                    <td class="am-text-middle"><?= date("Y-m-d H:i:s",$item['create_time']) ?></td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            
                                            <?php if (checkPrivilege('user/delete')): ?>
                                                <a class="j-delete tpl-table-black-operation-default"
                                                   href="javascript:void(0);"
                                                   data-id="<?= $item['jiuzhen_id'] ?>" title="删除用户">
                                                    <i class="am-icon-trash"></i> 删除
                                                </a>
                                            <?php endif; ?>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; else: ?>
                                <tr>
                                    <td colspan="13" class="am-text-center">暂无记录</td>
                                </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr"><?= $list->render() ?> </div>
                        <div class="am-fr pagination-total am-margin-right">
                            <div class="am-vertical-align-middle">总记录：<?= $list->total() ?></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<script>
    $(function () {
        // 删除元素
        var url = "<?= url('user/huanzhedelete') ?>";
        $('.j-delete').delete('jiuzhen_id', url, '删除后不可恢复，确定要删除吗？');

    });
    $('.j-export').click(function () {
        var data = {};
        var formData = $('#form-search').serializeArray();
        $.each(formData, function () {
            this.name !== 's' && (data[this.name] = this.value);
        });
        window.location = "<?= url('user/export') ?>" + '&' + $.urlEncode(data);
    });
</script>

